package cn.edu.scau.cmi.yangqing.hibernate.client.control;


import java.io.IOException;
import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import org.apache.catalina.authenticator.SpnegoAuthenticator.AcceptAction;

import cn.edu.scau.cmi.yangqing.factory.Creator;
import cn.edu.scau.cmi.yangqing.factory.CreatorPICC;
import cn.edu.scau.cmi.yangqing.factory.CreatorPingan;
import cn.edu.scau.cmi.yangqing.factory.Insurance;
import cn.edu.scau.cmi.yangqing.hibernate.util.StageManage;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

public class mainSceneControl implements Initializable {

	   @FXML
	   private Button adminButton;
	   
	   @FXML
	   private Button studentButton;
	   
	   @FXML
	   private Button tutorButton;
	   
	   @FXML
	   private TextField id;
	   
	   
	   public void initialize(URL location, ResourceBundle resources) {
	   }

	   public void adminButton(ActionEvent event) throws IOException {
		   StageManage.id = id.getText();
		   Stage stage=new Stage();
		   Parent root = FXMLLoader.load(
				   getClass().getResource("/cn/edu/scau/cmi/yangqing/hibernate/client/fxml/admin.fxml"));
		   stage.setTitle("@杨晴--管理员:");
		   stage.setScene(new Scene(root));
		   stage.show();
		   //将第二个窗口保存到map中
		   StageManage.STAGE.put("admin", stage);
		   //将本窗口保存到map中
		   StageManage.CONTROLLER.put("mainSceneControl", this);	 
	   }
	   public void studentButton(ActionEvent event) throws IOException {
		   StageManage.id = id.getText();
		   Stage stage=new Stage();
		   Parent root = FXMLLoader.load( getClass().getResource("/cn/edu/scau/cmi/yangqing/hibernate/client/fxml/student.fxml"));
		   stage.setTitle("@杨晴--学生");
		   stage.setScene(new Scene(root));
		   stage.show();
		   //将第二个窗口保存到map中
		   StageManage.STAGE.put("student", stage);
		   //将本窗口保存到map中
		   StageManage.CONTROLLER.put("mainSceneControl", this);
	   }
	   public void tutorButton(ActionEvent event) throws IOException {
		   StageManage.id = id.getText();
		   Stage stage=new Stage();
		   Parent root = FXMLLoader.load( getClass().getResource("/cn/edu/scau/cmi/yangqing/hibernate/client/fxml/tutor.fxml"));
		   stage.setTitle("@杨晴--导师");
		   stage.setScene(new Scene(root));
		   stage.show();
		   //将第二个窗口保存到map中
		   StageManage.STAGE.put("tutor", stage);
		   //将本窗口保存到map中
		   StageManage.CONTROLLER.put("mainSceneControl", this);
		   
	   }
	   
}
